﻿using System;
using System.Collections.Generic;
using System.Data;
using WAD.Model;


namespace WAD.DAL.Union
{
    public class DAOAgentJiLu : DAO_Union
    {
        public static PageData GetPageList(string fields, string where, int pageIndex, int pageSize)
        {
            PageData pageData = new PageData();
            if (!string.IsNullOrEmpty(where))
                where = " where " + where;

            DataTable dt = DAO_Union.ExecuteDataTable(string.Format("select top {0} {1} from vifo_users_agentjilu {2}", pageSize, fields, where));

            int total = (int)DAO_Union.ExecuteScalar(string.Format("select count(1) from vifo_users_agentjilu {0}", where));

            int itemCount = total;
            int pageCount = itemCount / pageSize;

            pageData.table = dt;
            pageData.pageSize = pageSize;
            pageData.pageIndex = pageIndex;
            pageData.pageCount = pageCount; //总页数
            pageData.itemCount = itemCount; //数据总条数
            return pageData;
        }
    }
}
